<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <input type="text" class="ipt1">
    <button>点我</button>
    <script>
        let ipt=document.querySelector('input')
        let btn=document.querySelector('button')

        btn.onclick=()=>{
            if(!ipt.value){
                alert('请输入内容')
                return
            }
            let one=ipt.value.substring(0,1)
            console.log(one>='a')
            if((one>='a'&&one<='z')||(one>='A'&&one<='Z')){
                alert('输入正确')
            }else{
                alert('格式错误')
            }
        }
    </script>
</body>
</html>